load("@rules_angular//src/optimization:index.bzl", "optimize_angular_app")
load("//tools:defaults.bzl", "jasmine_test", "ts_project")
load("//tools/symbol-extractor:index.bzl", "js_expected_symbol_test")

package(default_visibility = ["//visibility:public"])

optimize_angular_app(
    name = "bundles",
    srcs = [
        "main.ts",
    ],
    env = {
        "NG_BUILD_MANGLE": "0",
    },
    deps = [
        "//:node_modules/rxjs",
        "//:node_modules/tslib",
        "//packages/core/test/bundling:node_modules/@angular/build",
        "//packages/core/test/bundling:node_modules/@angular/common",
        "//packages/core/test/bundling:node_modules/@angular/core",
        "//packages/core/test/bundling:node_modules/@angular/forms",
        "//packages/core/test/bundling:node_modules/@angular/platform-browser",
    ],
)

ts_project(
    name = "test_lib",
    testonly = True,
    srcs = glob(["*_spec.ts"]),
    deps = [
        "//packages/compiler",
        "//packages/core",
        "//packages/core/testing",
        "//packages/private/testing",
    ],
)

jasmine_test(
    name = "test",
    data = [
        ":bundles",
        ":test_lib",
    ],
)

js_expected_symbol_test(
    name = "symbol_test",
    bundles_dir = ":bundles",
    golden = ":bundle.golden_symbols.json",
)
